﻿using Ease.EaseDialog.Scripts.Editor;
using Ease.EaseNode.Editor.NodeView;
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;

namespace Ease.EaseDialog.Editor
{
    public class DialogChartView : BaseEaseChartView
    {
        public new class UxmlFactory : UxmlFactory<DialogChartView, UxmlTraits>
        {
        }

        public DialogChartView() : base()
        {
            var styleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/Ease/EaseDialog/Scripts/Editor/DialogEW.uss");
            styleSheets.Add(styleSheet);
            //新建搜索菜单
            var menuWindowProvider = ScriptableObject.CreateInstance<CreateSearchMenuWindowProvider>();
            menuWindowProvider.OnSelectEntryHandler += OnMenuSelectEntry;
            nodeCreationRequest += context => { SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), menuWindowProvider); };
        }
    }
}